 package com.yunxi.controller.activiti;

import com.alibaba.fastjson.JSONObject;
import com.yunxi.activiti.service.ActivitiModelDubboService;
import io.swagger.annotations.Api;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
 //@Controller
 @RestController
 @Api(tags = "activiti:editor", description = "工作流画图保存接口")
 public class ModelEditorJsonRestResource
 {
   protected static final Logger LOGGER = LoggerFactory.getLogger(ModelEditorJsonRestResource.class);

//     @Reference(version = "${demo.service.version}",
//             application = "${dubbo.application.id}",
//             registry = "${dubbo.registry.address}",
//             url = "${dubbo.application.url}",
//             check = false,
//             timeout = 10000
//     )
     @Autowired
     private ActivitiModelDubboService activitiModelDubboService;



   @ResponseBody
   @RequestMapping(value={"/service/model/{modelId}/json"}, method={org.springframework.web.bind.annotation.RequestMethod.GET}, produces={"application/json"})
   public JSONObject getEditorJson(@PathVariable String modelId) {
      JSONObject json = activitiModelDubboService.getNodeModel(modelId);

     return json;
   }
 }